#include "myloginqrcode.h"

MyLoginQrCode::MyLoginQrCode(QWidget *parent) : QLabel(parent)
{

   enterStyle = "";
   leaveStyle = "";

   enterImgUrl = ":/icon/source/login/code_hover.png";
   leaveImgUrl = ":/icon/source/login/code_normal.png";

   this->setBackground(leaveImgUrl);
}


void MyLoginQrCode::enterEvent(QEvent *){
    this->setBackground(enterImgUrl);

    this->setStyleSheet(enterStyle);
}

void MyLoginQrCode::leaveEvent(QEvent *){
    this->setBackground(leaveImgUrl);

    this->setStyleSheet(leaveStyle);
}

void MyLoginQrCode::setBackground(QString imgUrl){
    QImage img;
    img.load(imgUrl);
    this->setPixmap(QPixmap::fromImage(img));
}
